package com.song.ssm.controller;

import com.song.ssm.mapper.RoomMapper;
import com.song.ssm.pojo.Room;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author TonySong
 * @date 2025/8/18 0018
 * @time 9:59
 */
@RestController
@RequestMapping("/book")
public class UserController {

    @Autowired
    private RoomMapper roomMapper;

    @GetMapping("/hello")
    public String hello() {
        return "hello";
    }

    @GetMapping(value = "/{id}",produces = MediaType.APPLICATION_JSON_VALUE)
    public Room findRoomById(@PathVariable("id") Long id){
        return roomMapper.selectByPrimaryKey(id);
     }

}
